/**
 * Created by ider on 5/19/16.
 */
'use strict';
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var serve = require('gulp-serve');
var react = require('gulp-react');
var closureCompiler = require('gulp-closure-compiler');
var sass = require('gulp-sass');
var postcss = require('gulp-postcss');


var path =['js/example.js','js/index.js']

gulp.task('sass', function () {
    var postcss      = require('gulp-postcss');
    // var sourcemaps   = require('gulp-sourcemaps');
    var autoprefixer = require('autoprefixer');

    return gulp.src('static/css/sass/*.scss')
        .pipe(sass().on('error', sass.logError))
        .pipe(postcss([ autoprefixer({ browsers: ['> 1%', 'IE 7'] }) ]))
        // .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('static/css/'))
});

gulp.task('watch', function() {
    var livereload = require('gulp-livereload');
    livereload.listen();
    gulp.watch('static/css/sass/*.scss', ['sass']);
});

//
//gulp.task('default',['react'],function() {
//    gulp.src('js/*.js')
//        // gulp.src(path)
//        .pipe(uglify())
//        .pipe(closureCompiler({
//            compilerPath: 'util/compiler.jar',
//            fileName: 'build.js'
//        }))
//        .pipe(concat('all.min.js'))
//
//        .pipe(gulp.dest('build'))
//
//
//});
//
//gulp.task('react', function () {
//    gulp.src('js/babel/example.js')
//        .pipe(react())
//        .pipe(gulp.dest('js'));
//});
//
//gulp.task('serve', serve('.'));
//gulp.task('serve-build', serve(['.']));
//gulp.task('serve-prod', serve({
//    root: ['.'],
//    port: 80
//
//}));
